# -*- coding: utf-8 -*-
import os.path
import urllib2
import sys
import re


url = 'http://www.cs.put.poznan.pl/mkasprzak/bio/'


request = urllib2.Request(url + 'testy.html')
res = urllib2.urlopen(request)


all = res.read().split('\n')

files = []
for line in all:
  x = re.search("[0-9]+\.[0-9]+[-\+][0-9]+", line)
  if x is not None:
    request = urllib2.Request(url + 'ins/' + x.group(0))
    res = urllib2.urlopen(request)
    f = open(x.group(0), 'w')
    f.write(res.read())
    f.close()